home *** CD-ROM | disk | FTP | other *** search
- class actionscript.Bullet extends MovieClip
- {
- var _hitTheTarget;
- var _maxDistance;
- var _canSlowDown;
- var game;
- var _type;
- var _speedX;
- var _speedY;
- var _distance;
- var tMc;
- var _damage;
- var _wLevel;
- function Bullet()
- {
- super();
- this._hitTheTarget = false;
- this._maxDistance = false;
- this._canSlowDown = true;
- this.game = this._parent._parent;
- §§push(this.gotoAndStop(this._type));
- if(this.game._sfxOn)
- {
- var _loc3_ = new Sound();
- _loc3_.attachSound(this._type + "_sound");
- _loc3_.start();
- }
- }
- function calcDistance(p1x, p1y, p2x, p2y)
- {
- var _loc2_ = Math.abs(p1x - p2x);
- var _loc1_ = Math.abs(p1y - p2y);
- var _loc3_ = Math.sqrt(_loc2_ * _loc2_ + _loc1_ * _loc1_);
- return _loc3_;
- }
- function onEnterFrame()
- {
- this._x += this._speedX;
- this._y += this._speedY;
- if(this.calcDistance(0,0,this._x,this._y) > this._distance)
- {
- if(this._type == "Fries" && this.tMc._type == "Ping Pangs" || this._type == "Pepsi" && this.tMc._type == "Skull" || this._type == "Wings" && this.tMc._type == "Pang Pangs" || this._type == "Pepsi" && this.tMc._type == "Orangupangs")
- {
- this._canSlowDown = false;
- this.removeMovieClip();
- }
- else
- {
- this.tMc.loseEnergy(this._damage);
- }
- if(this._type == "Pepsi" && this._canSlowDown)
- {
- this.tMc.slowDownEnemy(this._wLevel);
- }
- this.removeMovieClip();
- }
- }
- function removeBullet()
- {
- this.removeMovieClip();
- }
- }
-